﻿package com.mui.manager
{
    import flash.utils.*;

    public class ToolTipPool extends Object
    {
        private static var pools:Dictionary = new Dictionary();

        public function ToolTipPool()
        {
            return;
        }// end function

        private static function getPool(param1:Class) : Array
        {
            return param1 in pools ? (pools[param1]) : (var _loc_2:* = new Array(), pools[param1] = new Array(), _loc_2);
        }// end function

        public static function getObject(param1:Class, ... args)
        {
            args = getPool(param1);
            if (args.length > 0)
            {
                return args.pop();
            }
            return construct(param1, args);
        }// end function

        public static function disposeObject(param1, param2:Class = null) : void
        {
            var _loc_4:String = null;
            if (!param1)
            {
                return;
            }
            if (!param2)
            {
                _loc_4 = getQualifiedClassName(param1);
                param2 = getDefinitionByName(_loc_4) as Class;
            }
            var _loc_3:* = getPool(param2);
            _loc_3.push(param1);
            return;
        }// end function

        private static function construct(param1:Class, param2:Array)
        {
            switch(param2.length)
            {
                case 0:
                {
                    return new param1;
                }
                case 1:
                {
                    return new param1(param2[0]);
                }
                case 2:
                {
                    return new param1(param2[0], param2[1]);
                }
                case 3:
                {
                    return new param1(param2[0], param2[1], param2[2]);
                }
                case 4:
                {
                    return new param1(param2[0], param2[1], param2[2], param2[3]);
                }
                case 5:
                {
                    return new param1(param2[0], param2[1], param2[2], param2[3], param2[4]);
                }
                case 6:
                {
                    return new param1(param2[0], param2[1], param2[2], param2[3], param2[4], param2[5]);
                }
                case 7:
                {
                    return new param1(param2[0], param2[1], param2[2], param2[3], param2[4], param2[5], param2[6]);
                }
                case 8:
                {
                    return new param1(param2[0], param2[1], param2[2], param2[3], param2[4], param2[5], param2[6], param2[7]);
                }
                case 9:
                {
                    return new param1(param2[0], param2[1], param2[2], param2[3], param2[4], param2[5], param2[6], param2[7], param2[8]);
                }
                case 10:
                {
                    return new param1(param2[0], param2[1], param2[2], param2[3], param2[4], param2[5], param2[6], param2[7], param2[8], param2[9]);
                }
                default:
                {
                    return null;
                    break;
                }
            }
        }// end function

    }
}
